package com.jaws.demo.feign;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.jaws.core.common.vo.OpResponse;
import com.jaws.demo.feign.fallback.CloudServerFeignFallback;
import com.jaws.demo.vo.UserVO;


/**
 * 调用jaws-cloud-server
 * @author maojian
 * @date 2018-03-09 17:09:49
 * @since v1.0.0
 */
@Component
// @FeignClient(value = "jaws-cloud-server", url="http://localhost:8862", fallback=CloudServerFeignFallback.class)
@FeignClient(value = "jaws-cloud-server",path="/ntest", fallback = CloudServerFeignFallback.class)
public interface CloudServerFeign {

	/**
	 * get 方式调用,传递内容为string
	 * 
	 * @author maojian
	 * @date 2018-03-09 17:07:17
	 * @since v1.0.0
	 * @param name
	 * @return
	 */
	@RequestMapping(value = "/get/hi")
	OpResponse<String> getHi(@RequestParam("name") String name);

	/**
	 * post方式调用，传递内容为对象UserVO
	 * 
	 * @author maojian
	 * @date 2018-03-09 17:07:32
	 * @since v1.0.0
	 * @param req
	 * @return
	 */
	@PostMapping(value = "/post/hi")
	OpResponse<UserVO> postHi(UserVO req);

	/**
	 * get方式调用，模拟调用失败
	 * 
	 * @author maojian
	 * @date 2018-03-09 17:08:07
	 * @since v1.0.0
	 * @return
	 */
	@RequestMapping(value = "/get/fallback")
	OpResponse<String> getHiFallback();

	/**
	 * post方式调用，模拟失败
	 * 
	 * @author maojian
	 * @date 2018-03-09 17:08:32
	 * @since v1.0.0
	 * @return
	 */
	@RequestMapping(value = "/post/fallback")
	OpResponse<String> postHiFallback();
}
